#ifndef PIC_H
#define PIC_H

#include <QWidget>
#include <QPixmap>
#include <QImage>
#include <QPainter>
#include <QDebug>
#include <QVector>
#include <QColor>
#include "darkheap.h"
#include <iostream>
#include <algorithm>
using namespace std;

class Pic : public QWidget
{
     Q_OBJECT
public:
    Pic(QWidget *parent = 0);
public slots:
    void setready(bool);
    void setimg(QImage myimg);
    void rmfog();
private:
    QImage img;
    bool ready;
    int mask;
    double toprad;
    double omg;
    double t0;
    QVector<QVector<int> > dark;
    void mklight();
    QRgb light;
    void mkdark();
    void calc();
    int fix(int dat){
        if (dat<0)dat=0;
        else if (dat>255)dat=255;
        return dat;
    }
protected:
    void paintEvent ( QPaintEvent * event );

};

#endif // PIC_H
